import {jsonp} from 'vue-jsonp'

// 列表
export function getSuggestionList({keyword, key}) {
    return new Promise((resolve, reject) => {
        const params = {
            headers: {"content-type": "application/xml"},
            callbackQuery: "callbackParam",
            callbackName: "jsonpCallback"
        }
        //注意这里的地址参数需要连接起来中间不要有空格或者换行
        let url = `https://apis.map.qq.com/ws/place/v1/suggestion?keyword=${keyword}&key=${key}&output=jsonp&callback="jsonpCallback`;
        jsonp(url, params).then(res => {
            resolve(res);
        }).catch(err => {
            reject(err);
        })
    });
}
